﻿using BMSQ.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BMSQ.Admin.BusinessType
{
    public partial class Modify : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    string B_TypeID = Request.Params["id"];
                    ShowInfo(B_TypeID);
                }
            }
        }

        private void ShowInfo(string B_TypeID)
        {
            BLL.Business_Type bll = new BLL.Business_Type();
            Model.Business_Type model = bll.GetModel(B_TypeID);
            this.lblB_TypeID.Text = model.B_TypeID;
            this.txtB_TypeName.Text = model.B_TypeName;

        }

        public void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (this.txtB_TypeName.Text.Trim().Length == 0)
            {
                strErr += "B_TypeName不能为空！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string B_TypeID = this.lblB_TypeID.Text;
            string B_TypeName = this.txtB_TypeName.Text;


            Model.Business_Type model = new Model.Business_Type();
            model.B_TypeID = B_TypeID;
            model.B_TypeName = B_TypeName;

            BLL.Business_Type bll = new BLL.Business_Type();
            bll.Update(model);
            MessageBox.ShowAndRedirect(this, "保存成功！", "list.aspx");
        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}